package designModel.observer;

public class Test {

    private static class TeachClass implements Observer {
        //开始上课
        public void startClass() {
            Student student_01 = new Student("张三");
            Student student_02 = new Student("李四");
            Student student_03 = new Student("王五");
            Student student_04 = new Student("赵六");
            Teacher teacher = new Teacher();
            //课堂上有一个AI机器人,负责记录课堂内容
            teacher.register(this);
            teacher.register(student_01);
            teacher.register(student_02);
            teacher.register(student_03);
            teacher.register(student_04);
            //布置作业
            teacher.notify("抄课文");
        }

        @Override
        public void update(String msg) {
            System.out.println("本节课的作业是:" + msg);
        }
    }

    public static void main(String[] args) {
        //开始一节新的课程
        new TeachClass().startClass();
    }
}
